<%# Copyright 2009 Swansea University

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
%>
<% title "Projects by Research Centre" %>
<%= render(:partial=>"admin/navigation") %>
<%= render(:partial => "navigation") %>

<p><strong>This functionality has not been added yet! This page presents same results as order by discipline!</strong>
<p> <%= link_to "View all", {:action => 'index'} %> | <%= link_to "View by discipline", {:action => 'by_discipline'} %></p>
<%
 curr_disc = '';
%>
<p>
<% if @disciplines_proj.blank? %>
    <p>no projects to display</p>
<%else%>
  <ul id="projects">
    <% @disciplines_proj.each do |is| %>
 <%
          if curr_disc == ''
            curr_disc = Discipline.find(is.discipline_id).name
        %>
      <p><u><%= 'Projects suitable for ' + Discipline.find(is.discipline_id).name %><br></u></p>
      <%
          else
            if curr_disc != Discipline.find(is.discipline_id).name
        %>
    <p><u><%= 'Projects suitable for ' + Discipline.find(is.discipline_id).name %><br></u></p>
    <%
              curr_disc = Discipline.find(is.discipline_id).name
            end
          end
        %>
      <li>
  <%= link_to  Project.find(is.project_id).title, {:action => 'show', :id => is.id} -%>
      <%end%>
  </ul>
<%end%>

<p>To view projects sorted by creator <%= link_to "Click Here", {:action => 'by_supervisor'} %></p>
<p><%= link_to 'Back', {:action => 'index'} %></p>